//
//  RegisterSuccessAlert.m
//  Lightthings
//
//  Created by Hero on 2024/11/15.
//

#import "RegisterSuccessAlert.h"
#import "JYPopContainerView.h"
#import "JYRoot.h"


@interface RegisterSuccessAlert ()

@end

@implementation RegisterSuccessAlert

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.bar.titleLab.text = SWString(@"注册成功");
        
        
        UILabel * lab = [JYInitializer jy_initLabelWithText:SWString(@"尊敬的用户您好，为方便您更好地体验Lightthings App，请您先填写个人的真实性别、年龄、身高、体重等信息(我的>点击头像)，以便更准确计算您的健康数据，与您一起智能生活。\n\r以下更多丰富的功能:健康管理、睡眠管理、运动管理...等您来体验!") textColor:KLColor(@"000000") font:U_font(14) bgColor:[UIColor whiteColor] on:self layout:^(MASConstraintMaker * _Nonnull make) {
            kMakeLV(30);
            kMakeRV(-30);
            kMakeTV(20);
            kMakeBV(-klSafeAreaEdgeInsets.bottom - 30 - 50);
        }];
        lab.numberOfLines = 0;
        
        [JYInitializer jy_initButtonWithTarget:self action:@selector(clickLogin) title:SWString(@"立即登录") titleColor:KLColor(@"FFFFFF") font:U_font(16) bgColor:JYColor_Main() on:self layout:^(MASConstraintMaker * _Nonnull make) {
            kMakeLV(30);
            kMakeBV(-klSafeAreaEdgeInsets.bottom - 20);
            kMakeRV(-30);
            kMakeHV(45);
        }];
    }
    return self;
}

- (void)clickLogin {
    [kAppDelegate enterTabbar];
}

- (void)dimiss
{
    [self.popView dissmiss];
}
- (void)show
{
    if (self.popView) {
        [self.popView removeFromSuperview];
    }
    JYPopContainerView *popView = [JYRoot popBottomView:self animation:YES maker:^(MASConstraintMaker * _Nonnull make) {
        kMakeLRV(0);
        kMakeBV(0);
        kMakeHV(klSafeAreaEdgeInsets.bottom  + 300);
    } block:nil];
    [popView layoutSubviews];
    self.popView = popView;

    @weakify(popView);
    self.eventTransmissionBlock = ^(id  _Nonnull params, NSInteger tag) {
        @strongify(popView);
        if (tag == 0) {
            [popView dissmiss];
        }
    };

    [self.superview layoutIfNeeded];

}


- (NSString *)containerColor {
    return @"#FFFFFF";
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
